package com.easyclearance.baseutil;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;

import org.apache.commons.collections.CollectionUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

import com.alibaba.fastjson2.JSON;

import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;

@Repository
public class StringUtil {

	public static final Logger logger = Logger.getLogger(StringUtil.class);

	/**
	 * @汉字转拼音
	 * @param chinese
	 * @return
	 */
    public static String toPinyin(String chinese) {
        HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
        format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
        format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
 
        StringBuilder sb = new StringBuilder();
        char[] chars = chinese.toCharArray();
        for (char ch : chars) {
            if (Character.isWhitespace(ch)) {
                continue;
            }
            if (String.valueOf(ch).matches("[\u4e00-\u9fa5]")) {
                try {
                    String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(ch, format);
                    sb.append(pinyinArray[0]);
                } catch (BadHanyuPinyinOutputFormatCombination e) {
                    e.printStackTrace();
                }
            } else {
                sb.append(ch);
            }
        }
        return sb.toString();
    }
    
    public static String getId() {
    	return UUID.randomUUID().toString().replaceAll("-", "");
    }
    
    /**
     * @获取旅行团组码
     * @param count
     * @return
     */
    public static String genefourCode(Integer count) {
    	String code = String.valueOf(count);
    	if (code.length()==1) {
			code = "000" + code;
		}else if (code.length()==2) {
			code = "00" + code;
		}else if (code.length()==3) {
			code = "0" + code;
		}else if (code.length()==3) {
			code = "0" + code;
		}
    	return  code;
    }
    
    /**
     * @转换成汉字
     * @param pinyin
     * @return
     */
    public static String convertToChinese(String pinyin) {
        HanyuPinyinOutputFormat outputFormat = new HanyuPinyinOutputFormat();
        outputFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
 
        List<String> chineseList = new ArrayList<>();
        for (int i = 0; i < pinyin.length(); i++) {
            String singlePinyin = String.valueOf(pinyin.charAt(i));
            try {
                // 如果是中文字符，直接添加到列表中
                if (Character.toString(pinyin.charAt(i)).matches("[\u4e00-\u9fa5]")) {
                    chineseList.add(singlePinyin);
                } else {
                    // 如果是拼音字符，尝试转换成中文
                    String[] chineseArray = PinyinHelper.toHanyuPinyinStringArray(pinyin.charAt(i), outputFormat);
                    if (chineseArray != null) {
                        for (String chinese : chineseArray) {
                            chineseList.add(chinese);
                        }
                    }
                }
            } catch (BadHanyuPinyinOutputFormatCombination e) {
                e.printStackTrace();
            }
        }
        System.out.println("22"+JSON.toJSONString(chineseList));
        if (CollectionUtils.isNotEmpty(chineseList)) {
			String chineseString = "";
			for (int i = 0; i < chineseList.size(); i++) {
				chineseString = chineseString + chineseList.get(i);
			}
	        return chineseString;
		}else {
			return null;
		}
    }
    
    public static String convertPinyinToHanzi(String pinyin) {
        StringBuilder result = new StringBuilder();
        String[] pinyinArray = pinyin.split("\\s+");
        
        for (String pinyinItem : pinyinArray) {
            char[] charArray = pinyinItem.toCharArray();
            
            for (char c : charArray) {
                String[] pinyinWithTone = PinyinHelper.toHanyuPinyinStringArray(c);
                
                if (pinyinWithTone != null && pinyinWithTone.length > 0) {
                    result.append(pinyinWithTone[0]);
                } else {
                    result.append(c);
                }
            }
        }
        
        return result.toString();
    }

	/**
	 * @ 获取城市的拼音或者汉字
	 * @ param cityChinese
	 * @ return
	 */
	public static String getCityInfo(String cityChinese) {
		//首先去除无用字符
		cityChinese = cityChinese.replace("省", "").replace("市", "").replace("自治区", "").replace("回族", "").replace("维吾尔", "").replace("壮族", "");
		//定义城市英语
		String cityPinYin = "";
		//定义城市数组
		String[][] arr = {{"北京","BEIJING"},{"天津","TIANJIN"},{"河北","HEBEI"},{"山西","SHANXI"},{"内蒙古","NEIMONGOL"},{"辽宁","LIAONING"},{"吉林","JILIN"},{"黑龙江","HEILONGJIANG"},{"上海","SHANGHAI"},{"江苏","JIANGSU"},{"浙江","ZHEJIANG"},{"安徽","ANHUI"},{"福建","FUJIAN"},{"江西","JIANGXI"},{"山东","SHANDONG"},{"河南","HENAN"},{"湖北","HUBEI"},{"湖南","HUNAN"},{"广东","GUANGDONG"},{"广西","GUANGXI"},{"海南","HAINAN"},{"重庆","CHONGQING"},{"四川","SICHUAN"},{"贵州","GUIZHOU"},{"云南","YUNNAN"},{"西藏","XIZANG"},{"陕西","SHAANXI"},{"甘肃","GANSU"},{"青海","QINGHAI"},{"宁夏","NINGXIA"},{"新疆","XINJIANG"},{"台湾","TAIWAN"},{"香港","HONGKONG"},{"澳门","MACAU"},{"石家庄","SHIJIAZHUANG"},{"唐山","TANGSHAN"},{"秦皇岛","QINHUANGDAO"},{"邯郸","HANDAN"},{"邢台","XINGTAI"},{"保定","BAODING"},{"张家口","ZHANGJIAKOU"},{"承德","CHENGDE"},{"沧州","CANGZHOU"},{"廊坊","LANGFANG"},{"衡水","HENGSHUI"},{"太原","TAIYUAN"},{"大同","DATONG"},{"阳泉","YANGQUAN"},{"长治","CHANGZHI"},{"晋城","JINCHENG"},{"朔州","SHUOZHOU"},{"晋中","JINZHONG"},{"运城","YUNCHENG"},{"忻州","XINZHOU"},{"临汾","LINFEN"},{"吕梁","LVLIANG"},{"呼和浩特","HUHEHAOTE"},{"包头","BAOTOU"},{"乌海","WUHAI"},{"赤峰","CHIFENG"},{"通辽","TONGLIAO"},{"鄂尔多斯","EERDUOSHI"},{"呼伦贝尔","HULUNBEIER"},{"巴彦淖尔","BAYANNAOER"},{"乌兰察布","WULANCHABU"},{"兴安盟","XINANMENG"},{"锡林郭勒盟","TILINGUOLEMENG"},{"阿拉善盟","ALASHANMENG"},{"沈阳","SHENYANG"},{"大连","DALIAN"},{"鞍山","ANSHAN"},{"抚顺","FUSHUN"},{"本溪","BENXI"},{"丹东","DANDONG"},{"锦州","JINZHOU"},{"营口","YINGKOU"},{"阜新","FUXIN"},{"辽阳","LIAOYANG"},{"盘锦","PANJIN"},{"铁岭","TIELING"},{"朝阳","CHAOYANG"},{"葫芦岛","HULUDAO"},{"长春","CHANGCHUN"},{"四平","SIPING"},{"辽源","LIAOYUAN"},{"通化","TONGHUA"},{"白山","BAISHAN"},{"松原","SONGYUAN"},{"白城","BAICHENG"},{"延边","YANBIAN"},{"哈尔滨","HAERBIN"},{"齐齐哈尔","QIQIHAER"},{"鸡西","JIXI"},{"鹤岗","HEGANG"},{"双鸭山","SHUANGYASHAN"},{"大庆","DAQIANG"},{"伊春","YICHUN"},{"佳木斯","JIAMUSHI"},{"七台河","QITAIHE"},{"黑河","HEIHE"},{"绥化","SUIHUA"},{"大兴安岭","DAXINGANLING"},{"南京","NANJING"},{"无锡","WUXI"},{"徐州","XUZHOU"},{"常州","CHANGZHOU"},{"苏州","SUZHOU"},{"南通","NANTONG"},{"连云港","LIANYUNGANG"},{"淮安","HUAIAN"},{"盐城","YANCHENG"},{"扬州","YANGZHOU"},{"镇江","ZHENJIANG"},{"泰州","TAIZHOU"},{"宿迁","SUQIAN"},{"杭州","HANGZHOU"},{"宁波","NINGBO"},{"温州","WENZHOU"},{"嘉兴","JIAXIN"},{"湖州","HUZHOU"},{"绍兴","SHAOXIN"},{"金华","JINHUA"},{"衢州","QUZHOU"},{"舟山","ZHOUSHAN"},{"台州","TAIZHOU"},{"丽水","LISHUI"},{"合肥","HEFEI"},{"芜湖","WUHU"},{"蚌埠","BANGBU"},{"淮南","HUAINAN"},{"淮北","HUAIBEI"},{"铜陵","TONGLING"},{"安庆","ANQING"},{"黄山","HUANGSHAN"},{"滁州","CHUZHOU"},{"阜阳","FUYANG"},{"宿州","SUZHOU"},{"巢湖","CHAOHU"},{"六安","LIUAN"},{"亳州","BOZHOU"},{"池州","CHIZHOU"},{"宣城","XUANCHENG"},{"福州","FUZHOU"},{"厦门","XIAMEN"},{"莆田","FUTIAN"},{"三明","SANMENG"},{"泉州","QUANZHOU"},{"漳州","ZHANGZHOU"},{"南平","NANBENG"},{"龙岩","LONGYAN"},{"宁德","NINGDE"},{"南昌","NANCHANG"},{"景德镇","JINGDEZHEN"},{"萍乡","PINGXIANG"},{"九江","JIUJIANG"},{"新余","XINYU"},{"鹰潭","YINGTAN"},{"赣州","GANZHOU"},{"吉安","JIAN"},{"宜春","YICHUN"},{"抚州","FUZHOU"},{"上饶","SHANGRAO"},{"济南","JINAN"},{"青岛","QINGDAO"},{"淄博","ZIBO"},{"枣庄","ZAOZHUANG"},{"东营","DONGYING"},{"烟台","YANTAI"},{"潍坊","WEIFANG"},{"济宁","JINING"},{"泰安","TAIAN"},{"威海","WEIHAI"},{"日照","RIZHAO"},{"莱芜","LAIWU"},{"临沂","LINYI"},{"德州","DEZHOU"},{"聊城","LIAOCHENG"},{"滨州","BINZHOU"},{"荷泽","HEZE"},{"郑州","ZHENGZHOU"},{"开封","KAIFENG"},{"洛阳","LUOYANG"},{"平顶山","PINGDINGSHAN"},{"安阳","ANYANG"},{"鹤壁","HEBI"},{"新乡","XINXIANG"},{"焦作","JIAOZUO"},{"濮阳","PUYANG"},{"许昌","XUCHANG"},{"漯河","LEIHE"},{"三门峡","SANMENXIA"},{"南阳","NANYANG"},{"商丘","SHANGQIU"},{"信阳","XINYANG"},{"周口","ZHOUKOU"},{"驻马店","ZHUMADIAN"},{"武汉","WUHAN"},{"黄石","HUANGDAN"},{"宜昌","YICHANG"},{"襄樊","XIANGFAN"},{"鄂州","EZHOU"},{"荆门","JINGMEN"},{"孝感","XIAOGAN"},{"荆州","JINGZHOU"},{"黄冈","HUANGGANG"},{"咸宁","XIANNING"},{"随州","SUIZHOU"},{"恩施","ENSHI"},{"长沙","CHANGSHA"},{"株洲","ZHUZHOU"},{"湘潭","XIANGTAN"},{"衡阳","HENGYANG"},{"邵阳","SHAOYANG"},{"岳阳","YUEYANG"},{"常德","CHANGDE"},{"张家界","ZHANGJIAJIE"},{"益阳","YIYANG"},{"郴州","CHENZHOU"},{"永州","YONGZHOU"},{"怀化","HUAIHUA"},{"娄底","LOUDE"},{"湘西","XIANGXI"},{"广州","GUANGZHOU"},{"韶关","SHAOGUAN"},{"深圳","SHENZHEN"},{"珠海","ZHUHAI"},{"汕头","SHANTOU"},{"佛山","FOSHAN"},{"江门","JIANGMEN"},{"湛江","ZHANJIANG"},{"茂名","MAOMING"},{"肇庆","ZHAOQING"},{"惠州","HUIZHOU"},{"梅州","MEIZHOU"},{"汕尾","SHANWEI"},{"河源","HEYUAN"},{"阳江","YANGJIANG"},{"清远","QINGYUAN"},{"东莞","DONGGUAN"},{"中山","ZHONGSHAN"},{"潮州","CHAOZHOU"},{"揭阳","JIEYANG"},{"云浮","YUNFU"},{"南宁","NANNING"},{"柳州","LIUZHOU"},{"桂林","GUILIN"},{"梧州","WUZHOU"},{"北海","BEIHAI"},{"防城港","FANGCHENGGANG"},{"钦州","QINZHOU"},{"贵港","GUIGANG"},{"玉林","YULIN"},{"百色","BAISE"},{"贺州","HEZHOU"},{"河池","HECHE"},{"来宾","LAIBIN"},{"崇左","CHONGZUO"},{"海口","HAIKOU"},{"三亚","SANYA"},{"成都","CHENGDU"},{"自贡","ZIGONG"},{"攀枝花","PANZHIHUA"},{"泸州","LUZHOU"},{"德阳","DEYANG"},{"绵阳","MIANYANG"},{"广元","GUANGYUAN"},{"遂宁","SUINING"},{"内江","NEIJIANG"},{"乐山","LESHAN"},{"南充","NANCHONG"},{"眉山","MEISHAN"},{"宜宾","YIBIN"},{"广安","GUANGAN"},{"达州","DAZHOU"},{"雅安","YAAN"},{"巴中","BAZHONG"},{"资阳","ZIYANG"},{"阿坝","ABA"},{"甘孜","GANZI"},{"凉山","LIANGSHAN"},{"贵阳","GUIYANG"},{"六盘水","LIUPANSHUI"},{"遵义","ZUNXI"},{"安顺","ANSHUN"},{"铜仁","TONGREN"},{"黔西南","QIANXINAN"},{"毕节","BIJIE"},{"黔东南","QIANDONGNAN"},{"黔南","QIANNAN"},{"昆明","KUNMING"},{"曲靖","QUJING"},{"玉溪","YUXI"},{"保山","BAOSHAN"},{"昭通","SHAOTONG"},{"丽江","LIJIANG"},{"思茅","SIMAO"},{"临沧","LINCANG"},{"楚雄","CHUXIONG"},{"文山","WENSHAN"},{"西双版纳","XISHUANGBANNA"},{"大理","DALI"},{"德宏","DEHONG"},{"怒江","NUJIANG"},{"迪庆","DIQIANG"},{"拉萨","LASA"},{"昌都地","CHANGDOUDE"},{"山南地","SHANNANDE"},{"日喀则","RIKAZE"},{"那曲地","NAQUDE"},{"阿里","ALI"},{"林芝","LINZHI"},{"西安","XIAN"},{"铜川","TONGCHUAN"},{"宝鸡","BAOJI"},{"咸阳","XIANYANG"},{"渭南","WEINAN"},{"延安","YANAN"},{"汉中","HANZHONG"},{"榆林","YULIN"},{"安康","ANKANG"},{"商洛","SHANGLUO"},{"兰州","LANZHOU"},{"嘉峪关","JIAYUGUAN"},{"金昌","JINCHANG"},{"白银","BAIYIN"},{"天水","TIANSHUI"},{"武威","WUWEI"},{"张掖","ZHANGYE"},{"平凉","PINGLIANG"},{"酒泉","JIUQUAN"},{"庆阳","QINGYANG"},{"定西","DINGXI"},{"陇南","LONGNAN"},{"临夏","LINXIA"},{"甘南","GANNAN"},{"西宁","XINING"},{"海东","HAIDONG"},{"海北","HAIBEI"},{"黄南","HUANGNAN"},{"果洛","GUANLUO"},{"玉树","YUSHU"},{"海西","HAIXI"},{"银川","YINCHUAN"},{"石嘴山","DANZUISHAN"},{"吴忠","WUZHONG"},{"固原","GUYUAN"},{"中卫","ZHONGWEI"},{"乌鲁木齐","WULUMUQI"},{"克拉玛依","KELAMAYI"},{"吐鲁番","TULUBO"},{"哈密","HAMI"},{"昌吉回族","CHANGJIHUICOU"},{"博尔塔拉","BOERDALA"},{"巴音郭楞","BAYINGUO"},{"阿克苏","AKESU"},{"克孜勒苏","KEZILESU"},{"喀什","KASHEN"},{"和田","HETIAN"},{"伊犁","YILI"},{"塔城","TACHENG"},{"阿勒泰","ALETAI"},{"海外","HAIWAI"},{"美国","MEIGUO"},{"英国","YINGGUO"},{"法国","FAGUO"},{"德国","DEGUO"},{"意大利","YIDALI"},{"瑞士","RUISHI"},{"西班牙","XIBANYA"},{"葡萄牙","PUTAOYA"},{"俄罗斯","ELUOSHI"},{"日本","RIBEN"},{"韩国","HANGUO"},{"澳大利亚","AODALIYA"},{"新加坡","XINJIAPO"},{"印度","YINDU"},{"马来西亚","MALAIXIYA"},{"印度尼西亚","YIDUNIXIYA"},{"巴基斯坦","BAJISHITAN"},{"巴西","BAXI"},{"墨西哥","MEIXIGE"},{"阿根廷","AGENTING"},{"智利","ZHILI"},{"加拿大","JIANADA"},{"其它","JITA"},{"东城","DONGCHENG"},{"西城","XICHENG"},{"崇文","CHONGWEN"},{"宣武","XUANWU"},{"丰台","FENGSI"},{"石景山","DANJINGSHAN"},{"海淀","HAIDIAN"},{"门头沟","MENTOUGOU"},{"房山","FANGSHAN"},{"通州","TONGZHOU"},{"顺义","SHUNXI"},{"大兴","DAXIN"},{"怀柔","FUROU"},{"平谷","BENGGU"},{"密云","MIYUN"},{"延庆","YANQIANG"},{"黄埔","HUANGBU"},{"卢湾","LUWAN"},{"徐汇","XUHUI"},{"长宁","CHANGNING"},{"静安","JINGAN"},{"普陀","PUDUO"},{"闸北","GEBEI"},{"虹口","GONGKOU"},{"杨浦","YANGPU"},{"宝山","BAOSHAN"},{"闵行","MINHANG"},{"嘉定","JIADING"},{"浦东新区","PUDONGXINGOU"},{"松江","SONGJIANG"},{"金山","JINSHAN"},{"青浦","JINGPU"},{"南汇","NANHUI"},{"奉贤","FENGXIAN"},{"崇明","CHONGMENG"},{"和平","HEBENG"},{"河东","HEDONG"},{"河西","HEXI"},{"南开","NANKAI"},{"红桥","GONGQIAO"},{"塘沽","TANGGU"},{"汉沽","HANGU"},{"大港","DAGANG"},{"东丽","DONGLI"},{"西青","XIJING"},{"北辰","BEICHEN"},{"津南","JINNAN"},{"武清","WUQING"},{"宝坻","BAOCHI"},{"静海","JINGHAI"},{"宁河","NINGHE"},{"蓟县","JIXIAN"},{"渝中","YUZHONG"},{"大渡口","DADUKOU"},{"江北","JIANGBEI"},{"沙坪坝","SHAPINGBA"},{"九龙坡","JIULONGPO"},{"南岸","NANAN"},{"北碚","BEIBEI"},{"万盛","MOCHENG"},{"双桥","SHUANGQIAO"},{"渝北","YUBEI"},{"巴南","BANAN"},{"万州","MOZHOU"},{"涪陵","FULING"},{"黔江","QIANJIANG"},{"长寿","CHANGSHOU"},{"永川市","YONGCHUANFU"},{"合川市","GECHUANFU"},{"江津市","JIANGJINFU"},{"南川市","NANCHUANFU"},{"綦江","QIJIANG"},{"潼南","CHONGNAN"},{"荣昌","RONGCHANG"},{"璧山","BISHAN"},{"大足","DAJU"},{"铜梁","TONGLIANG"},{"梁平","LIANGBENG"},{"城口","CHENGKOU"},{"垫江","DIANJIANG"},{"武隆","WULONG"},{"丰都","FENGDOU"},{"奉节","FENGJIE"},{"开县","KAIXIAN"},{"云阳","YUNYANG"},{"忠县","ZHONGXIAN"},{"巫峡","WUXIA"},{"巫山","WUSHAN"},{"石柱","DANZHU"},{"秀山","XIUSHAN"},{"酉阳","YOUYANG"},{"彭水","PENGSHUI"},{"中国","CHINA"},{"仰光","YANGON"},{"纽约","NEW YORK"},{"洛杉矶","LOS ANGELES"},{"磨憨(公路)","Mohan Highway"},{"磨憨(铁路)","Mohan Railway"}};
		List<String[]> asList = Arrays.asList(arr);
		//过滤数据
		final String finalcityChinese = cityChinese;
		if (finalcityChinese.matches("[a-zA-Z]+")) {
			List<String[]> collect = asList.stream().filter(t->Objects.equals(t[1], finalcityChinese.toUpperCase())).collect(Collectors.toList());
			if (CollectionUtils.isNotEmpty(collect)) {
				String[] provinceInfo = collect.get(0);
				cityPinYin = provinceInfo[0];
			}
		}else {
			List<String[]> collect = asList.stream().filter(t->Objects.equals(t[0], finalcityChinese.toUpperCase())).collect(Collectors.toList());
			if (CollectionUtils.isNotEmpty(collect)) {
				String[] provinceInfo = collect.get(0);
				cityPinYin = provinceInfo[1];
			}
		}
		if (cityPinYin.equals("")) cityPinYin = cityChinese;
		
		return cityPinYin;
	}


	/**
	 * @ 获取国籍英文名称
	 * @ param countryCn
	 * @ return
	 */
	public static String getNationalityInfo(String nationality) {
		//去除特殊字符
		nationality = nationality.replaceAll("\\s*", "");
		//定义国家信息
		String nationalityInfo = "";
		System.out.println(nationality);
		//定义国家数组
		String[][] arr = {{"中国","Chinese"},{"CHN","Chinese"},{"埃及","Egyptian"},{"爱尔兰","Irish"},{"奥地利","Austrian"},{"澳大利亚","Australian"},{"巴西","Brazilian"},{"波兰","Polish"},{"德国","German"},{"俄国","Russian"},{"法国","French"},{"芬兰","finnish"},{"韩国","Korean"},{"荷兰","Dutch"},{"加拿大","Canadian"},{"美国","American"},{"尼日利亚","Nigerian"},{"挪威","Norweigian"},{"葡萄牙","Portuguese"},{"日本","Japanese"},{"瑞国","Swedish"},{"瑞士","Swiss"},{"苏格兰","Scots.Scottish"},{"泰国","Thailand"},{"威尔士","Welsh"},{"西班牙","Spanish"},{"希腊","Greek"},{"新西兰","New Zealander"},{"以色列","lsraeli"},{"意大利","Italian"},{"印度","Indian"},{"英国","English"}};
		if (nationality.matches("[a-zA-Z]+")) {
			//循环获取
			final String finanationality = nationality.toUpperCase();
			List<String[]> asList = Arrays.asList(arr);
			List<String[]> nationcollect = asList.stream().filter(t->Objects.equals(t[1].toUpperCase(), finanationality)).collect(Collectors.toList());
			if (CollectionUtils.isNotEmpty(nationcollect)) {
				nationalityInfo = nationcollect.get(0)[0]+"/"+finanationality;
			}else {
				nationalityInfo = finanationality+"/"+finanationality;
			}
		}else {
			//循环获取
			final String finanationality = nationality;
			List<String[]> asList = Arrays.asList(arr);
			List<String[]> nationcollect = asList.stream().filter(t->Objects.equals(t[0].toUpperCase(), finanationality)).collect(Collectors.toList());
			if (CollectionUtils.isNotEmpty(nationcollect)) {
				nationalityInfo = finanationality+"/"+nationcollect.get(0)[1];
			}else {
				nationalityInfo = finanationality+"/"+finanationality;
			}
		}
		return nationalityInfo;
	}
	
	/**
	 * @ 获取国籍英文名称
	 * @ param countryCn
	 * @ return
	 */
	public static String getNationaInfo(String nationality) {
		//去除特殊字段
		nationality = nationality.replaceAll("\\s*", "");
		//定义国家信息
		String nationalityInfo = "";
		//定义国家数组
		String[][] arr = {{"中国","CHN"}, {"阿富汗","AFG"}, {"新加坡","SGP"}, {"阿尔巴尼亚","ALB"}, {"阿尔及利亚","DZA"}, {"安道尔","AND"}, {"安哥拉","AGO"}, {"安圭拉","AIA"}, {"安提瓜","ATG"}, {"阿根廷","ARG"}, {"亚美尼亚","ARM"}, {"阿鲁巴","ABW"}, {"澳大利亚","AUS"}, {"奥地利","AUT"}, {"阿塞拜疆","AZE"}, {"巴哈马","BHS"}, {"巴林","BHR"}, {"孟加拉国","BGD"}, {"巴巴多斯","BRB"}, {"白俄罗斯","BLR"}, {"比利时","BEL"}, {"伯利兹","BLZ"}, {"贝宁","BEN"}, {"不丹","BTN"}, {"玻利维亚","BOL"}, {"波斯尼亚和黑塞哥维那","BIH"}, {"博茨瓦纳","BWA"}, {"巴西","BRA"}, {"文莱","BRN"}, {"英属印度洋领土","GBR"}, {"保加利亚","BGR"}, {"布基纳法索","BFA"}, {"布隆迪","BDI"}, {"柬埔寨","KHM"}, {"喀麦隆","CMR"}, {"加拿大","CAN"}, {"佛得角","CPV"}, {"中非共和国","CAF"}, {"乍得","TCD"}, {"智利","CHL"}, {"哥伦比亚","COL"}, {"科摩罗","COM"}, {"冈果","COG"}, {"哥斯达黎加","CRI"}, {"克罗地亚","HRV"}, {"古巴","CUB"}, {"塞浦路斯","CYP"}, {"捷克共和国","CZE"}, {"丹麦","DNK"}, {"吉布提","DJI"}, {"多米尼克共和国","DOM"}, {"多米尼克","DMA"}, {"朝鲜民主主义人民共和国","PRK"}, {"东帝汶","TLS"}, {"厄瓜多尔","ECU"}, {"埃及","EGY"}, {"多米尼加共和国","DOM"}, {"赤道几内亚","GNQ"}, {"厄立特里亚","ERI"}, {"爱沙尼亚","EST"}, {"埃塞俄比亚","ETH"}, {"斐济","FJI"}, {"芬兰","FIN"}, {"法国","FRA"}, {"加蓬","GAB"}, {"冈比亚","GMB"}, {"德国","D"}, {"加纳","GHA"}, {"希腊","GRC"}, {"格林纳达","GRD"}, {"危地马拉","GTM"}, {"几内亚","GIN"}, {"几内亚比绍","GNB"}, {"圭亚那","GUY"}, {"海地","HTI"}, {"洪都拉斯","HND"}, {"匈牙利","HUN"}, {"冰岛","ISL"}, {"印度","IND"}, {"印度尼西亚","IDN"}, {"伊朗","IRN"}, {"伊拉克","IRQ"}, {"爱尔兰","IRL"}, {"以色列","ISR"}, {"意大利","ITA"}, {"象牙海岸","CIV"}, {"日本","JPN"}, {"牙买加","JAM"}, {"约旦","JOR"}, {"哈萨克斯坦","KAZ"}, {"肯尼亚","KEN"}, {"基里巴斯","KIR"}, {"科索沃","RKS"}, {"科威特","KWT"}, {"吉尔吉斯斯坦","KGZ"}, {"老挝","LAO"}, {"拉脱维亚","LVA"}, {"黎巴嫩","LBN"}, {"莱索托","LSO"}, {"利比里亚","LBR"}, {"利比亚","LBY"}, {"列支敦士登","LIE"}, {"立陶宛","LTU"}, {"卢森堡","LUX"}, {"马达加斯加","MDG"}, {"马拉维","MWI"}, {"马来西亚","MYS"}, {"马尔代夫","MDV"}, {"马里","MLI"}, {"马耳他","MLT"}, {"马绍尔群岛","MHL"}, {"毛里塔尼亚","MRT"}, {"毛里求斯","MUS"}, {"墨西哥","MEX"}, {"摩纳哥","MCO"}, {"蒙古","MNG"}, {"摩洛哥","MAR"}, {"莫桑比克","MOZ"}, {"摩尔多瓦","MDA"}, {"黑山","MNE"}, {"缅甸","MMR"}, {"纳米比亚","NAM"}, {"瑙鲁","NRU"}, {"尼泊尔","NPL"}, {"荷兰","NLD"}, {"新喀里多尼亚","NCL"}, {"新西兰","NZL"}, {"尼加拉瓜","NIC"}, {"尼日尔","NER"}, {"尼日利亚","NGA"}, {"北马其顿","MKD"}, {"挪威","NOR"}, {"阿曼","OMN"}, {"巴基斯坦","PAK"}, {"巴拿马","PAN"}, {"巴布亚新几内亚","PNG"}, {"巴拉圭","PRY"}, {"帕劳","PLW"}, {"秘鲁","PER"}, {"菲律宾","PHL"}, {"波兰","POL"}, {"葡萄牙","PRT"}, {"卡塔尔","QAT"}, {"罗马尼亚","ROU"}, {"俄罗斯","RUS"}, {"卢旺达","RWA"}, {"萨摩亚","WSM"}, {"圣多美和普林西比","STP"}, {"沙特阿拉伯","SAU"}, {"圣文森特和格林纳丁斯","VCT"}, {"圣卢西亚","LCA"}, {"塞内加尔","SEN"}, {"塞舌尔","SYC"}, {"塞拉利昂","SLE"}, {"斯洛伐克共和国","SVK"}, {"斯洛文尼亚","SVN"}, {"韩国","KOR"}, {"所罗门群岛","SLB"}, {"索马里","SOM"}, {"南非","ZAF"}, {"南苏丹","SSD"}, {"西班牙","ESP"}, {"斯里兰卡","LKA"}, {"苏丹","SDN"}, {"苏里南","SUR"}, {"瑞典","SWE"}, {"瑞士","CHE"}, {"叙利亚","SYR"}, {"中国-台湾","TWN"}, {"塔吉克斯坦","TJK"}, {"坦桑尼亚","TZA"}, {"泰国","THA"}, {"多哥","TGO"}, {"汤加","TON"}, {"特立尼达和多巴哥","TTO"}, {"突尼斯","TUN"}, {"土耳其","TUR"}, {"土库曼斯坦","TKM"}, {"图瓦卢","TUV"}, {"乌干达","UGA"}, {"乌克兰","UKR"}, {"英国","GBR"}, {"美国","USA"}, {"阿拉伯联合酋长国","ARE"}, {"乌拉圭","URY"}, {"乌兹别克斯坦","UZB"}, {"瓦努阿图","VUT"}, {"委内瑞拉","VEN"}, {"越南","VNM"}, {"也门","YEM"}, {"赞比亚","ZMB"}, {"津巴布韦","ZIM"}};
		List<String[]> asList = Arrays.asList(arr);
		final String finalnationality = nationality.toUpperCase();
		if (nationality.matches("[a-zA-Z]+")) {
			if (finalnationality.length()>3) {
				nationalityInfo = getNationalityInfo(finalnationality);
			}else {
				List<String[]> nationCollectArr = asList.stream().filter(t->Objects.equals(t[1].toUpperCase(), finalnationality)).collect(Collectors.toList());
				if (CollectionUtils.isNotEmpty(nationCollectArr)) {
					nationalityInfo = nationCollectArr.get(0)[0];
				}
				nationalityInfo = getNationalityInfo(nationalityInfo);
			}
		}else {
			nationalityInfo = getNationalityInfo(finalnationality);
		}
		return nationalityInfo;
	}
	
	/**
	 * @ 获取国籍英文名称
	 * @ param countryCn
	 * @ return
	 */
	public static String getThreeNationaInfo(String nationality) {
		//去除特殊字段
		nationality = nationality.replaceAll("\\s*", "");
		//定义国家信息
		String nationalityInfo = "";
		//定义国家数组
		String[][] arr = {{"中国","CHN"}, {"阿富汗","AFG"}, {"新加坡","SGP"}, {"阿尔巴尼亚","ALB"}, {"阿尔及利亚","DZA"}, {"安道尔","AND"}, {"安哥拉","AGO"}, {"安圭拉","AIA"}, {"安提瓜","ATG"}, {"阿根廷","ARG"}, {"亚美尼亚","ARM"}, {"阿鲁巴","ABW"}, {"澳大利亚","AUS"}, {"奥地利","AUT"}, {"阿塞拜疆","AZE"}, {"巴哈马","BHS"}, {"巴林","BHR"}, {"孟加拉国","BGD"}, {"巴巴多斯","BRB"}, {"白俄罗斯","BLR"}, {"比利时","BEL"}, {"伯利兹","BLZ"}, {"贝宁","BEN"}, {"不丹","BTN"}, {"玻利维亚","BOL"}, {"波斯尼亚和黑塞哥维那","BIH"}, {"博茨瓦纳","BWA"}, {"巴西","BRA"}, {"文莱","BRN"}, {"英属印度洋领土","GBR"}, {"保加利亚","BGR"}, {"布基纳法索","BFA"}, {"布隆迪","BDI"}, {"柬埔寨","KHM"}, {"喀麦隆","CMR"}, {"加拿大","CAN"}, {"佛得角","CPV"}, {"中非共和国","CAF"}, {"乍得","TCD"}, {"智利","CHL"}, {"哥伦比亚","COL"}, {"科摩罗","COM"}, {"冈果","COG"}, {"哥斯达黎加","CRI"}, {"克罗地亚","HRV"}, {"古巴","CUB"}, {"塞浦路斯","CYP"}, {"捷克共和国","CZE"}, {"丹麦","DNK"}, {"吉布提","DJI"}, {"多米尼克共和国","DOM"}, {"多米尼克","DMA"}, {"朝鲜民主主义人民共和国","PRK"}, {"东帝汶","TLS"}, {"厄瓜多尔","ECU"}, {"埃及","EGY"}, {"多米尼加共和国","DOM"}, {"赤道几内亚","GNQ"}, {"厄立特里亚","ERI"}, {"爱沙尼亚","EST"}, {"埃塞俄比亚","ETH"}, {"斐济","FJI"}, {"芬兰","FIN"}, {"法国","FRA"}, {"加蓬","GAB"}, {"冈比亚","GMB"}, {"德国","D"}, {"加纳","GHA"}, {"希腊","GRC"}, {"格林纳达","GRD"}, {"危地马拉","GTM"}, {"几内亚","GIN"}, {"几内亚比绍","GNB"}, {"圭亚那","GUY"}, {"海地","HTI"}, {"洪都拉斯","HND"}, {"匈牙利","HUN"}, {"冰岛","ISL"}, {"印度","IND"}, {"印度尼西亚","IDN"}, {"伊朗","IRN"}, {"伊拉克","IRQ"}, {"爱尔兰","IRL"}, {"以色列","ISR"}, {"意大利","ITA"}, {"象牙海岸","CIV"}, {"日本","JPN"}, {"牙买加","JAM"}, {"约旦","JOR"}, {"哈萨克斯坦","KAZ"}, {"肯尼亚","KEN"}, {"基里巴斯","KIR"}, {"科索沃","RKS"}, {"科威特","KWT"}, {"吉尔吉斯斯坦","KGZ"}, {"老挝","LAO"}, {"拉脱维亚","LVA"}, {"黎巴嫩","LBN"}, {"莱索托","LSO"}, {"利比里亚","LBR"}, {"利比亚","LBY"}, {"列支敦士登","LIE"}, {"立陶宛","LTU"}, {"卢森堡","LUX"}, {"马达加斯加","MDG"}, {"马拉维","MWI"}, {"马来西亚","MYS"}, {"马尔代夫","MDV"}, {"马里","MLI"}, {"马耳他","MLT"}, {"马绍尔群岛","MHL"}, {"毛里塔尼亚","MRT"}, {"毛里求斯","MUS"}, {"墨西哥","MEX"}, {"摩纳哥","MCO"}, {"蒙古","MNG"}, {"摩洛哥","MAR"}, {"莫桑比克","MOZ"}, {"摩尔多瓦","MDA"}, {"黑山","MNE"}, {"缅甸","MMR"}, {"纳米比亚","NAM"}, {"瑙鲁","NRU"}, {"尼泊尔","NPL"}, {"荷兰","NLD"}, {"新喀里多尼亚","NCL"}, {"新西兰","NZL"}, {"尼加拉瓜","NIC"}, {"尼日尔","NER"}, {"尼日利亚","NGA"}, {"北马其顿","MKD"}, {"挪威","NOR"}, {"阿曼","OMN"}, {"巴基斯坦","PAK"}, {"巴拿马","PAN"}, {"巴布亚新几内亚","PNG"}, {"巴拉圭","PRY"}, {"帕劳","PLW"}, {"秘鲁","PER"}, {"菲律宾","PHL"}, {"波兰","POL"}, {"葡萄牙","PRT"}, {"卡塔尔","QAT"}, {"罗马尼亚","ROU"}, {"俄罗斯","RUS"}, {"卢旺达","RWA"}, {"萨摩亚","WSM"}, {"圣多美和普林西比","STP"}, {"沙特阿拉伯","SAU"}, {"圣文森特和格林纳丁斯","VCT"}, {"圣卢西亚","LCA"}, {"塞内加尔","SEN"}, {"塞舌尔","SYC"}, {"塞拉利昂","SLE"}, {"斯洛伐克共和国","SVK"}, {"斯洛文尼亚","SVN"}, {"韩国","KOR"}, {"所罗门群岛","SLB"}, {"索马里","SOM"}, {"南非","ZAF"}, {"南苏丹","SSD"}, {"西班牙","ESP"}, {"斯里兰卡","LKA"}, {"苏丹","SDN"}, {"苏里南","SUR"}, {"瑞典","SWE"}, {"瑞士","CHE"}, {"叙利亚","SYR"}, {"中国-台湾","TWN"}, {"塔吉克斯坦","TJK"}, {"坦桑尼亚","TZA"}, {"泰国","THA"}, {"多哥","TGO"}, {"汤加","TON"}, {"特立尼达和多巴哥","TTO"}, {"突尼斯","TUN"}, {"土耳其","TUR"}, {"土库曼斯坦","TKM"}, {"图瓦卢","TUV"}, {"乌干达","UGA"}, {"乌克兰","UKR"}, {"英国","GBR"}, {"美国","USA"}, {"阿拉伯联合酋长国","ARE"}, {"乌拉圭","URY"}, {"乌兹别克斯坦","UZB"}, {"瓦努阿图","VUT"}, {"委内瑞拉","VEN"}, {"越南","VNM"}, {"也门","YEM"}, {"赞比亚","ZMB"}, {"津巴布韦","ZIM"}};
		List<String[]> asList = Arrays.asList(arr);
		final String finalnationality = nationality.toUpperCase();
		List<String> collect = asList.stream().filter(t->Objects.equals(finalnationality, t[0])).map(t->t[1]).collect(Collectors.toList());
		if (CollectionUtils.isNotEmpty(collect)) {
			nationalityInfo = collect.get(0);
		}
		return nationalityInfo;
	}
	
	/**
	 * @ 获取字符中的字母和数字
	 * @ param countryCn
	 * @ return
	 */
	public static String[] getCharNumByString(String string) {
		String [] arr = new String[2];

		try {
			//去除特殊字段
			string = string.replaceAll("\\s*", "");
			//定义国家信息
			String charString = "";
			String numString = "";
			for (int i = 0; i < string.length(); i++) {
				char charAt = string.charAt(i);
				if (Character.isDigit(charAt)) {
					numString = numString+charAt;
				}else if (Character.isLetter(charAt)) {
					charString = charString+charAt;
				}
			}
			arr[0]=charString;
			arr[1]=numString;
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}

		return arr;
	}
	
	/**
	 * * 计算两个日期之间距离的天数
	 * @ param str1
	 * @ param str2
	 * @ return
	 */
	public static int differentDaysl(String str1,String str2){

		Date date1 = null;
		Date date2 = null;
		try {
			date1 = new SimpleDateFormat("yyyy-MM-dd").parse(str1);
			date2 = new SimpleDateFormat("yyyy-MM-dd").parse(str2);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		Calendar cal1 = Calendar.getInstance();
		cal1.setTime(date1);

		Calendar cal2 = Calendar.getInstance();
		cal2.setTime(date2);
		int day1= cal1.get(Calendar.DAY_OF_YEAR);
		int day2 = cal2.get(Calendar.DAY_OF_YEAR);

		int year1 = cal1.get(Calendar.YEAR);
		int year2 = cal2.get(Calendar.YEAR);
		if(year1 != year2){
			int timeDistance = 0 ;
			for(int i = year1 ; i < year2 ; i ++){
				if(i%4==0 && i%100!=0 || i%400==0){
					timeDistance += 366;
				}else{
					timeDistance += 365;
				}
			}
			return timeDistance + (day2-day1 + 1) ;
		}else{
			return day2-day1+1;
		}
	}
	
	public static Map<String, Object> getThailandNation() {
		Map<String, Object> jsonObject = new HashMap<>(); 
		try {
			jsonObject.put("ABW","ABW : ARUBA");
			jsonObject.put("AFG","AFG : AFGHAN");
			jsonObject.put("AGO","AGO : ANGOLAN");
			jsonObject.put("AIA","AIA : ANGUILLA");
			jsonObject.put("ALA","ALA : ALANDIC");
			jsonObject.put("ALB","ALB : ALBANIAN");
			jsonObject.put("AND","AND : ANDORAIN");
			jsonObject.put("ANT","ANT : NETHERLANDS ANTILLES");
			jsonObject.put("ARE","ARE : THE UNITED ARAB EMIRATES");
			jsonObject.put("ARG","ARG : ARGENTINE");
			jsonObject.put("ARM","ARM : ARMENIAN");
			jsonObject.put("ASM","ASM : AMERICA SAMOA");
			jsonObject.put("ATF","ATF : FRENCH SOUTHERN TERRIORIES");
			jsonObject.put("ATG","ATG : ANTIGUAN AND BARBUDA");
			jsonObject.put("AUS","AUS : AUSTRALIAN");
			jsonObject.put("AUT","AUT : AUSTRIAN");
			jsonObject.put("AZE","AZE : AZERBAIJANI");
			jsonObject.put("BDI","BDI : BURUNDI");
			jsonObject.put("BEL","BEL : BELGIAN");
			jsonObject.put("BEN","BEN : BENINESE");
			jsonObject.put("BES","BES : STATIAN");
			jsonObject.put("BFA","BFA : BURKINA FASO");
			jsonObject.put("BGD","BGD : BANGLADESH");
			jsonObject.put("BGR","BGR : BULGARIAN");
			jsonObject.put("BHR","BHR : BAHRAINI");
			jsonObject.put("BHS","BHS : BAHAMIAN");
			jsonObject.put("BIH","BIH : BOSNIA AND HERZEGOVINA");
			jsonObject.put("BLM","BLM : SAINT BARTHELEMOIS");
			jsonObject.put("BLR","BLR : BELARUSIAN");
			jsonObject.put("BLZ","BLZ : BELIZEAN");
			jsonObject.put("BMU","BMU : BERMUDAN");
			jsonObject.put("BOL","BOL : BOLIVIAN");
			jsonObject.put("BRA","BRA : BRAZILIAN");
			jsonObject.put("BRB","BRB : BARBADIAN");
			jsonObject.put("BRN","BRN : BRUNEI DARUSSALAM");
			jsonObject.put("BTN","BTN : BHUTANESE");
			jsonObject.put("BVT","BVT : BOUVET ISLAND");
			jsonObject.put("BWA","BWA : BOTSWANA");
			jsonObject.put("CAF","CAF : CENTRAL AFRICAN");
			jsonObject.put("CAN","CAN : CANADIAN");
			jsonObject.put("CCK","CCK : COCOS (KEELING) ISLANDS");
			jsonObject.put("CHE","CHE : SWISS");
			jsonObject.put("CHL","CHL : CHILEAN");
			jsonObject.put("CHN","CHN : CHINESE");
			jsonObject.put("CIV","CIV : Cote d’Ivoire");
			jsonObject.put("CMR","CMR : CAMEROONIAN");
			jsonObject.put("COD","COD : CONGOLESE");
			jsonObject.put("COG","COG : CONGOLESE");
			jsonObject.put("COK","COK : COOK ISLANDER");
			jsonObject.put("COL","COL : COLOMBIAN");
			jsonObject.put("COM","COM : COMOROS");
			jsonObject.put("CPV","CPV : CAPE VERDEAN");
			jsonObject.put("CRI","CRI : COSTA RICAN");
			jsonObject.put("CUB","CUB : CUBAN");
			jsonObject.put("CUW","CUW : CURACOAN");
			jsonObject.put("CXR","CXR : CHRISTMAS ISLAND");
			jsonObject.put("CYM","CYM : CAYMAN ISLANDER");
			jsonObject.put("CYP","CYP : CYPRIOT");
			jsonObject.put("CZE","CZE : CZECH REPUBLIC");
			jsonObject.put("DEU","DEU : GERMAN");
			jsonObject.put("DJI","DJI : DJIBOUTI");
			jsonObject.put("DMA","DMA : DOMINICA");
			jsonObject.put("DNK","DNK : DANISH");
			jsonObject.put("DOM","DOM : DOMINICAN");
			jsonObject.put("DZA","DZA : ALGERIAN");
			jsonObject.put("ECU","ECU : ECUADORIAN");
			jsonObject.put("EGY","EGY : EGYPTIAN");
			jsonObject.put("ERI","ERI : ERITREAN");
			jsonObject.put("ESH","ESH : SAHRAWI");
			jsonObject.put("ESP","ESP : SPANISH");
			jsonObject.put("EST","EST : ESTONIAN");
			jsonObject.put("ETH","ETH : ETHIOPIAN");
			jsonObject.put("FIN","FIN : FINNISH");
			jsonObject.put("FJI","FJI : FIJIAN");
			jsonObject.put("FLK","FLK : FALKLAND ISLANDS (MALVINAS)");
			jsonObject.put("FRA","FRA : FRENCH");
			jsonObject.put("FRO","FRO : FAEROES ISLANDER");
			jsonObject.put("FSM","FSM : MICRONESIAN");
			jsonObject.put("GAB","GAB : GABONESE");
			jsonObject.put("GBN","GBN : BRITISH NATIONAL (OVERSEAS)");
			jsonObject.put("GBR","GBR : BRITISH");
			jsonObject.put("GEO","GEO : GEORGIAN");
			jsonObject.put("GGY","GGY : GUERNSEY ISLANDER");
			jsonObject.put("GHA","GHA : GHANAIAN");
			jsonObject.put("GIB","GIB : GIBRALTAR");
			jsonObject.put("GIN","GIN : GUINEAN");
			jsonObject.put("GLP","GLP : GUADELOUPEAN");
			jsonObject.put("GMB","GMB : GAMBIAN");
			jsonObject.put("GNB","GNB : GUINEA-BISSAUAN");
			jsonObject.put("GNQ","GNQ : EQUATORIAL GUINEAN");
			jsonObject.put("GRC","GRC : GREEK");
			jsonObject.put("GRD","GRD : GRENADIAN");
			jsonObject.put("GRL","GRL : GREENLANDER");
			jsonObject.put("GTM","GTM : GUATEMALAN");
			jsonObject.put("GUF","GUF : FRENCH GUIANA");
			jsonObject.put("GUM","GUM : GUAMANIAN");
			jsonObject.put("GUY","GUY : GUYANESE");
			jsonObject.put("HKG","HKG : CHINA-HONG KONG");
			jsonObject.put("HMD","HMD : HEARD AND MCDONALD ISLANDS");
			jsonObject.put("HND","HND : HONDURAN");
			jsonObject.put("HRV","HRV : CROATIA");
			jsonObject.put("HTI","HTI : HAITIAN");
			jsonObject.put("HUN","HUN : HUNGARIAN");
			jsonObject.put("IDN","IDN : INDONESIAN");
			jsonObject.put("IMN","IMN : MANX");
			jsonObject.put("IND","IND : INDIAN");
			jsonObject.put("IOT","IOT : BRITISH INDIAN OCEAN TERR.");
			jsonObject.put("IRL","IRL : IRISH");
			jsonObject.put("IRN","IRN : IRANIAN");
			jsonObject.put("IRQ","IRQ : IRAQI");
			jsonObject.put("ISL","ISL : ICELANDIC");
			jsonObject.put("ISR","ISR : ISRAELI");
			jsonObject.put("ITA","ITA : ITALIAN");
			jsonObject.put("JAM","JAM : JAMAICAN");
			jsonObject.put("JEY","JEY : JERSEY ISLANDER");
			jsonObject.put("JOR","JOR : JORDANIAN");
			jsonObject.put("JPN","JPN : JAPANESE");
			jsonObject.put("KAZ","KAZ : KAZAKH");
			jsonObject.put("KEN","KEN : KENYAN");
			jsonObject.put("KGZ","KGZ : KYRGYZ");
			jsonObject.put("KHM","KHM : CAMBODIAN");
			jsonObject.put("KIR","KIR : KIRIBATIAN");
			jsonObject.put("KNA","KNA : ST.CHRISTOPHERAN");
			jsonObject.put("KOR","KOR : SOUTH KOREAN");
			jsonObject.put("KWT","KWT : KUWAITI");
			jsonObject.put("LAO","LAO : LAO");
			jsonObject.put("LBN","LBN : LEBANESE");
			jsonObject.put("LBR","LBR : LIBERIAN");
			jsonObject.put("LBY","LBY : LIBYAN");
			jsonObject.put("LCA","LCA : SAINT LUCIAN");
			jsonObject.put("LIE","LIE : LIECHTENSTEIN");
			jsonObject.put("LKA","LKA : SRI LANKAN");
			jsonObject.put("LSO","LSO : LESOTHON");
			jsonObject.put("LTU","LTU : LITHUANIAN");
			jsonObject.put("LUX","LUX : LUXEMBURGERG");
			jsonObject.put("LVA","LVA : LATVIAN");
			jsonObject.put("MAC","MAC : CHINA-MACAO");
			jsonObject.put("MAF","MAF : SAINT-MARTINOIS");
			jsonObject.put("MAR","MAR : MOROCCAN");
			jsonObject.put("MCO","MCO : MONEGASQUE");
			jsonObject.put("MDA","MDA : MOLDOVAN");
			jsonObject.put("MDG","MDG : MALAGASY");
			jsonObject.put("MDV","MDV : MALDIVIAN");
			jsonObject.put("MEX","MEX : MEXICAN");
			jsonObject.put("MHL","MHL : MARSHALL ISLANDER");
			jsonObject.put("MKD","MKD : MACEDONIA");
			jsonObject.put("MLI","MLI : MALIIAN");
			jsonObject.put("MLT","MLT : MALTESE");
			jsonObject.put("MMR","MMR : MYANMAR");
			jsonObject.put("MNE","MNE : CRNA GORA MONTENEGRO");
			jsonObject.put("MNG","MNG : MONGOLIA");
			jsonObject.put("MNP","MNP : MARIANAN");
			jsonObject.put("MOZ","MOZ : MOZAMBICAN");
			jsonObject.put("MRT","MRT : MAURITANIAN");
			jsonObject.put("MSR","MSR : MONTSERRAT");
			jsonObject.put("MTQ","MTQ : MARTINIQUE");
			jsonObject.put("MUS","MUS : MAURITIAN");
			jsonObject.put("MWI","MWI : MALAWIAN");
			jsonObject.put("MYS","MYS : MALAYSIAN");
			jsonObject.put("MYT","MYT : MAYOTTE");
			jsonObject.put("N02","N02 : GUINEAN");
			jsonObject.put("NAM","NAM : NAMIBIAN");
			jsonObject.put("NCL","NCL : NEW CALEDONIAN");
			jsonObject.put("NER","NER : NIGER");
			jsonObject.put("NFK","NFK : NORFOLK ISLAND");
			jsonObject.put("NGA","NGA : NIGERIAN");
			jsonObject.put("NIC","NIC : NICARAGUAN");
			jsonObject.put("NIU","NIU : NIUE");
			jsonObject.put("NLD","NLD : DUTCH");
			jsonObject.put("NOR","NOR : NORWEGIAN");
			jsonObject.put("NPL","NPL : NEPALESE");
			jsonObject.put("NRU","NRU : NAURUAN");
			jsonObject.put("NZL","NZL : NEW ZEALANDER");
			jsonObject.put("OMN","OMN : OMANI");
			jsonObject.put("PAK","PAK : PAKISTAN");
			jsonObject.put("PAN","PAN : PANAMANIAN");
			jsonObject.put("PCI","PCI : TRUST PACIFIC");
			jsonObject.put("PCN","PCN : PITCAIRN");
			jsonObject.put("PER","PER : PERUVIAN");
			jsonObject.put("PHL","PHL : PHILIPPINE");
			jsonObject.put("PLW","PLW : PALAUAN");
			jsonObject.put("PNG","PNG : PAPUA NEW GUINEA");
			jsonObject.put("POL","POL : POLISH");
			jsonObject.put("PRI","PRI : PUERTO RICAN");
			jsonObject.put("PRK","PRK : NORTH KOREAN");
			jsonObject.put("PRT","PRT : PORTUGUESE");
			jsonObject.put("PRY","PRY : PARAGUAYAN");
			jsonObject.put("PSE","PSE : PALESTINIAN");
			jsonObject.put("PYF","PYF : FRENCH POLYNESIA");
			jsonObject.put("QAT","QAT : QATAR");
			jsonObject.put("REU","REU : REUNION ISLANDER");
			jsonObject.put("RKS","RKS : REPUBLIC OF KOSOVO");
			jsonObject.put("ROU","ROU : ROMANIAN");
			jsonObject.put("RUS","RUS : RUSSIAN");
			jsonObject.put("RWA","RWA : RWANDAN");
			jsonObject.put("SAU","SAU : SAUDI ARABIAN");
			jsonObject.put("SCT","SCT : SCOTTISH");
			jsonObject.put("SDN","SDN : SUDANESE");
			jsonObject.put("SEN","SEN : SENEGALESE");
			jsonObject.put("SGP","SGP : SINGAPOREAN");
			jsonObject.put("SGS","SGS : SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS");
			jsonObject.put("SHN","SHN : ST. HELENA");
			jsonObject.put("SJM","SJM : SVALBARD AND JAN MAYEN ISLANDS");
			jsonObject.put("SLB","SLB : SOLOMON ISLANDER");
			jsonObject.put("SLE","SLE : SIERRA LEONEAN");
			jsonObject.put("SLV","SLV : SALVADORAN");
			jsonObject.put("SMR","SMR : SAN MARINO");
			jsonObject.put("SOM","SOM : SOMALIAN");
			jsonObject.put("SPM","SPM : ST. PEIRRE AND MIQUELON");
			jsonObject.put("SRB","SRB : SERBIA");
			jsonObject.put("SSD","SSD : REPUBLIC OF SOUTH SUDAN");
			jsonObject.put("STP","STP : SAO TOME/PRINCIPE");
			jsonObject.put("SUR","SUR : SURINAM");
			jsonObject.put("SVK","SVK : SLOVAK");
			jsonObject.put("SVN","SVN : SLOVENE");
			jsonObject.put("SWE","SWE : SWEDISH");
			jsonObject.put("SWZ","SWZ : SWAZI");
			jsonObject.put("SXM","SXM : SINT MAARTENER");
			jsonObject.put("SYC","SYC : SEYCHELLOIS");
			jsonObject.put("SYR","SYR : SYRIAN");
			jsonObject.put("TCA","TCA : TURKS AND CAICOS ISLANDS");
			jsonObject.put("TCD","TCD : CHADIAN");
			jsonObject.put("TGO","TGO : TOGOLESE");
			jsonObject.put("TJK","TJK : TAJIK");
			jsonObject.put("TKL","TKL : TOKELAU");
			jsonObject.put("TKM","TKM : TURKMEN");
			jsonObject.put("TLS","TLS : TIMOR-LESTE");
			jsonObject.put("TON","TON : TONGAN");
			jsonObject.put("TTO","TTO : TRINIDAD AND TOBAGO");
			jsonObject.put("TUN","TUN : TUNISIAN");
			jsonObject.put("TUR","TUR : TURKISH");
			jsonObject.put("TUV","TUV : TUVALUAN");
			jsonObject.put("TWN","TWN : TAIWANESE");
			jsonObject.put("TZA","TZA : TANZANIAN");
			jsonObject.put("UGA","UGA : UGANDAN");
			jsonObject.put("UKR","UKR : UKRANIAN");
			jsonObject.put("UMI","UMI : UNITED STATES MINOR OUTLYING ISLANDS");
			jsonObject.put("UNO","UNO : UNITED NATION");
			jsonObject.put("URY","URY : URUGUAYAN");
			jsonObject.put("USA","USA : AMERICAN");
			jsonObject.put("UZB","UZB : UZBEK");
			jsonObject.put("VAT","VAT : THE HOLY SEE");
			jsonObject.put("VCT","VCT : SAINT VINCENT AND THE GRENADINES");
			jsonObject.put("VEN","VEN : VENEZUELAN");
			jsonObject.put("VGB","VGB : BRITISH VIRGIN ISLANDER");
			jsonObject.put("VIR","VIR : U.S. VIRGIN ISLANDER");
			jsonObject.put("VNM","VNM : VIETNAMESE");
			jsonObject.put("VUT","VUT : VANUATU");
			jsonObject.put("WLF","WLF : WALLIS AND FUTUNA ISLANDS");
			jsonObject.put("WSM","WSM : SAMOAN");
			jsonObject.put("XKX","XKX : KOSOVAN");
			jsonObject.put("XXA","XXA : STATELESS");
			jsonObject.put("XXB","XXB : REFUGEE (1951 CONVENTION)");
			jsonObject.put("XXC","XXC : REFUGEE (OTHER)");
			jsonObject.put("XXX","XXX : UNKNOWN");
			jsonObject.put("YEM","YEM : YEMENI");
			jsonObject.put("ZAF","ZAF : SOUTH AFRICAN");
			jsonObject.put("ZMB","ZMB : ZAMBIAN");
			jsonObject.put("ZWE","ZWE : ZIMBABWEAN (ZWE)");
			
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return jsonObject;
	}
	
	public static String getBeforeStayCountryByName(String countryName) {
		String str = "";
		try {
			if (Objects.equals(countryName, "PEOPLE'S REPUBLIC OF CHINA")) {
				str = "CHN : PEOPLE'S REPUBLIC OF CHINA";
			} else if (Objects.equals(countryName, "MALAYSIA")) {
				str = "MYS : MALAYSIA";
			} else if (Objects.equals(countryName, "LAO PEOPLE'S DEMOCRATIC REPUBLIC")) {
				str = "LAO : LAO PEOPLE'S DEMOCRATIC REPUBLIC";
			} else if (Objects.equals(countryName, "KINGDOM OF CAMBODIA")) {
				str = "KHM : KINGDOM OF CAMBODIA";
			} else if (Objects.equals(countryName, "THE REPUBLIC OF SINGAPORE")) {
				str = "SGP : THE REPUBLIC OF SINGAPORE";
			} else if (Objects.equals(countryName, "SOCIALIST REPUBLIC OF VIETNAM")) {
				str = "VNM : SOCIALIST REPUBLIC OF VIETNAM";
			} else if (Objects.equals(countryName, "REPUBLIC OF INDONESIA")) {
				str = "IDN : REPUBLIC OF INDONESIA";
			} else if (Objects.equals(countryName, "HONGKONG SAR, CHINA")) {
				str = "HKG : HONGKONG SAR, CHINA";
			} else if (Objects.equals(countryName, "MACAO SAR, CHINA")) {
				str = "MAC : MACAO SAR, CHINA";
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return str;
	} 
	
	public static String getBeforeStayCountryByCode(String countryName) {
		String str = "";
		try {
			if (Objects.equals(countryName, "86")) {
				str = "CHN : PEOPLE'S REPUBLIC OF CHINA";
			} else if (Objects.equals(countryName, "60")) {
				str = "MYS : MALAYSIA";
			} else if (Objects.equals(countryName, "856")) {
				str = "LAO : LAO PEOPLE'S DEMOCRATIC REPUBLIC";
			} else if (Objects.equals(countryName, "857")) {
				str = "KHM : KINGDOM OF CAMBODIA";
			} else if (Objects.equals(countryName, "65")) {
				str = "SGP : THE REPUBLIC OF SINGAPORE";
			} else if (Objects.equals(countryName, "84")) {
				str = "VNM : SOCIALIST REPUBLIC OF VIETNAM";
			} else if (Objects.equals(countryName, "62")) {
				str = "IDN : REPUBLIC OF INDONESIA";
			} else if (Objects.equals(countryName, "852")) {
				str = "HKG : HONGKONG SAR, CHINA";
			} else if (Objects.equals(countryName, "853")) {
				str = "MAC : MACAO SAR, CHINA";
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return str;
	} 
	
    public static void main(String[] args) {
    	String string = "CA123";
    	System.out.println(getCharNumByString(string)[0]);
	}
}
